﻿using Core.Domain.Entities;
using Core.Migrations.Extensions;
using FluentMigrator;

namespace Infrastructure.Persistence.Migrations.Roles;

[Migration(202510232219)]
public class CreateColumn : ForwardOnlyMigration
{
    public override void Up()
    {
        Alter.Table(typeof(Role).GetTableName())
          .InSchema(SchemaNames.Identity)
          .AddColumn("TenantId").AsString(100).Nullable().WithColumnDescription("租户标识")
          .AddColumn(MigrationExpressions.ColumnNameFor<Role>(nameof(Role.Code))).AsString(100).Nullable().WithColumnDescription("编码")
          .AddColumn(MigrationExpressions.ColumnNameFor<Role>(nameof(Role.Name))).AsString(100).Indexed("IX_Roles_Name").Nullable().WithColumnDescription("名称"); 
    }
}
